import axios from "axios"

let BaseConfig = axios.create({
    baseURL: "http://localhost:979",
    timeout: 5000,
    headers: {
        'Content-Type': 'application/json'
    },
    
});

//请求拦截器
BaseConfig.interceptors.request.use(
    (config) => {
      if (localStorage.library_sys_token) {
        config.headers.Authorization = localStorage.library_sys_token;
      }
      return config;
    },
    (error) => {

      return Promise.reject(error);
    }
  );

  // 响应拦截器
  BaseConfig.interceptors.response.use(
    (response) => {
      return response;
    },
    (error) => {
      return Promise.reject(error);
    }
  );

export default BaseConfig;